<!DOCTYPE html>
            
<HTML>
<HEAD>
<meta name="booktitle" content="Developing Applications With Objective Caml" >
 <meta charset="ISO-8859-1"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<META name="GENERATOR" content="hevea 1.05-7 of 2000-02-24">
<META NAME="Author" CONTENT="Christian.Queinnec@lip6.fr">
<LINK rel=stylesheet type="text/css" href="videoc-ocda.css">
<script language="JavaScript" src="videoc.js"><!--
//--></script>
<TITLE>
 Presentation of Part III
</TITLE>
</HEAD>
<BODY class="regularBody">
<A HREF="book-ora125.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A>
<A HREF="book-ora128.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>

<H2> Presentation of Part III</H2>The third part of this work is dedicated to application development and
describes two ways of organizing applications: modules and objects. The
goal is to easily structure an application for incremental and rapid
development, maintenance facilitated by the ability to change gracefully,
and the possibility of reusing large parts for future development.<BR>
<BR>
We have already presented the language's predefined modules
(<A HREF="index.html#chap-Bibliotheques">8</A>) viewed as compilation units.
Objective CAML's module language supports on the one hand the
definition of new simple modules in order to build one's own libraries, perhaps
including abstract types, and on the other hand the definition of modules
parameterized by other modules, called 
functors. The advantage of this parameterization lies in being able
to ``apply'' a module to different argument modules in order to create
specialized modules. Communication between modules is thus explicit, via
the parameter module signature, which contains the types of its
global declarations. However, nothing stops you from applying a functor to
a module with a more extended signature, as long as it remains
compatible with the specified parameter signature.<BR>
<BR>
Besides, the Objective CAML language has an object-oriented extension.
First of all object-oriented programming permits structured communication
between objects. Rather than applying a function to some arguments, one
sends a message (a request) to an object which knows how to deal with
it. The object, an instance of a class (a structure gathering together
data and methods), then executes the corresponding code. The main relation
between classes is inheritance, which lets one describe subclasses which
retain all the declarations of the ancestor class. Late binding between
the name of a message and the corresponding code within the object takes
place during program execution. Nevertheless Objective CAML typing guarantees
that the receiving object will always have a method of this name, otherwise
type inference would have raised a compile-time error. The second
important relation is subtyping, where an object of a certain class can
always be used in place of an object of another class. In this way a new
type of polymorphism is introduced: inclusion polymorphism.<BR>
<BR>
Finally the construction of a graphical interface, begun in chapter
<A HREF="index.html#chap-PG">5</A>, uses different event management models. One puts together
in an interface several components with respect to which the user or the
system can produce events. The association of a component with a
handler for one or more events taking place on it allows one to easily add
to and modify such interfaces. The component-event-handler association can
be cloaked in several forms: definition of a function (called a callback),
inheritance with redefinition of handler methods, or finally
registration of a handling object (delegation model).<BR>
<BR>
Chapter <A HREF="index.html#chap-PM">14</A> is a presentation of modular programming. The
different prevailing terminologies of abstract data types and module
languages are explained and illustrated by simple modules. Then the module
language is detailed. The correspondence between modules (simple or not)
and compilation units is made clear.<BR>
<BR>
Chapter <A HREF="index.html#chap-POO">15</A> contains an introduction to object-oriented
programming. It brings a new way of structuring Objective CAML programs, an
alternative to modules. This chapters shows how the notions of
object-oriented programming (simple and multiple inheritance, abstract
classes, parameterized classes, late binding) are articulated with respect
to the language's type system, and extend it by the subtyping relation to
inclusion polymorphism.<BR>
<BR>
Chapter <A HREF="index.html#chap-C-Organisation">16</A> compares the two preceding software
models and explains what factors to consider in deciding between the two,
while also demonstrating how to simulate one by the other. It treats
various cases of mixed models. Mixing leads to the enrichment of each of
these two models, in particular with parameterized classes using the
abstract type of a module.<BR>
<BR>
Chapter <A HREF="index.html#chap-PART3-Applications">17</A> presents two classes of
applications: two-player games, and the construction of a world of
virtual robots. The first example is organized via various
parameterized modules. In particular, a parameterized module is used to
represent games for application of the minimax <FONT FACE=symbol>a</FONT><FONT FACE=symbol>b</FONT>
algorithm. It is then applied to two specific games: Connect&nbsp;4 and
Stone Henge. The second example uses an object model of a world and
of abstract robots, from which, by inheritence, various simulations
are derived. This example is presented in chapter
<A HREF="index.html#chap-PART4-Applications">21</A>.<BR>
<BR>
<BR>
<BR>
<HR>
<A HREF="book-ora125.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A>
<A HREF="book-ora128.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>
